$(function(){
	$( "#radio1,#radio2,#radio3,#radio4" ).buttonset();
	$("label").click(function(){
		var radioName = $("#"+$(this).attr('for')).attr("name");
		$("input[name='"+radioName+"'][checked]").attr("checked",false);
		$("#"+$(this).attr('for')).attr("checked",true);
	});
	
	$("#btnAddFav").click(function(){
		var favBookInfo = {};
		favBookInfo.fontSize = $("input[name='radio1'][checked]").val();
		favBookInfo.backgroundColor = $("input[name='radio2'][checked]").val();
		favBookInfo.width = $("input[name='radio3'][checked]").val();
		favBookInfo.autoScroll = $("input[name='radio4'][checked]").val();
		localStorage.setItem('configs',JSON.stringify(favBookInfo));
		var dialog = $('<div id="dialog" title="&#25552;&#31034;&#20449;&#24687;"/>')
		dialog.append($('<p>&#24744;&#22909;&#65292;&#38405;&#35835;&#39029;&#38754;&#30340;&#37197;&#32622;&#20449;&#24687;&#24050;&#20445;&#23384;&#25104;&#21151;&#65281;</p>'));
		dialog.dialog({width:'200',height:'100'});
	});
})